﻿@model eShopModernizedMVC.Models.CatalogItem

@{
    ViewBag.Title = "Create";
}

<h2 class="esh-body-title">Create</h2>


@using (Html.BeginForm())
{
    <div class="container">

    <div class="row">
        <div class="col-md-4">
            <div class="row"><img class="esh-picture" src="@Model.PictureUri" /></div>

            @if (ViewBag.UseAzureStorage)
            {
                <div class="row">
                    <div class="col-md-6">
                        <label class="btn btn-default esh-button-upload">
                            Upload image <input type="file" id="uploadEditorImage" accept="image/*" class="hidden" />
                        </label>
                        @Html.HiddenFor(model => model.TempImageName)
                    </div>

                    <div class="esh-loader col-md-3 hidden"></div>
                    <div class="col-md-6">
                        <span class="text-danger field-validation-error" id="img-validation-error"></span>
                    </div>
                </div>
            }
        </div>


        <div class="col-md-8 form-horizontal">
            @Html.ValidationSummary(true, "", new { @class = "text-danger" })
            <div class="form-group">
                @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-8">
                    @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.Description, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-8">
                    @Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.Description, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.CatalogBrandId, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-8">
                    @Html.DropDownList("CatalogBrandId", null, htmlAttributes: new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.CatalogBrandId, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.CatalogTypeId, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-8">
                    @Html.DropDownList("CatalogTypeId", null, htmlAttributes: new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.CatalogTypeId, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.Price, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-8">
                    @Html.EditorFor(model => model.Price, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.Price, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.AvailableStock, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-8">
                    @Html.EditorFor(model => model.AvailableStock, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.AvailableStock, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.RestockThreshold, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-8">
                    @Html.EditorFor(model => model.RestockThreshold, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.RestockThreshold, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.MaxStockThreshold, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-8">
                    @Html.EditorFor(model => model.MaxStockThreshold, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.MaxStockThreshold, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-offset-2 col-md-8 text-right esh-button-actions">
                    @Html.ActionLink("[ Cancel ]", "Index", null, new { @class = "btn esh-button esh-button-secondary" })
                    <input type="submit" value="[ Create ]" class="btn esh-button esh-button-primary" />
                </div>
            </div>
        </div>


    </div>


    </div>
    
}

<div>
    
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
